home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / admin / linuxcon.000 / linuxcon / linuxconf-1.6 / uucp / poll.c < prev    next >
C/C++ Source or Header  |  1996-03-26  |  2KB  |  86 lines

  1. #include <stdio.h>
  2. #include <string.h>
  3. #include "../misc/misc.h"
  4. #include "internal.h"
  5. #include "uucp.h"
  6. #include "uucp.m"
  7. #include "../paths.h"
  8.  
  9. extern UUCP_HELP_FILE help_uucp;
  10. static CONFIG_FILE f_poll (VAR_LIB_UUCP_POLL
  11.     ,help_uucp
  12.     ,CONFIGF_OPTIONNAL|CONFIGF_MANAGED
  13.     ,"uucp","uucp",0660);
  14.  
  15.  
  16. PUBLIC POLL::POLL (const char *_system)
  17. {
  18.     system.setfrom (_system);
  19. }
  20.  
  21. PUBLIC POLL::POLL (const POLL *p)
  22. {
  23.     system.setfrom(p->system);
  24.     sched.setfrom (p->sched);
  25. }
  26.  
  27. PUBLIC POLL::POLL (
  28.     const char *buf,    // Buffer to parse from the Permissions file
  29.     const SSTRING &_comments,    // Comments preceding the definition
  30.     char *err)            // Will contain error message or '\0'
  31. {
  32.     comments.setfrom (_comments);
  33.     comments.strip_end();
  34.     err[0] = '\0';
  35.     buf = system.copyword (buf);
  36.     buf = str_skip(buf);
  37.     sched.setfrom (buf);
  38. }
  39.  
  40. /*
  41.     Write one record in the Permissions file
  42. */
  43. PUBLIC void POLL::write (FILE *fout)
  44. {
  45.     comment_write (comments,fout);
  46.     fprintf (fout,"%s\t%s\n",system.get(),sched.get());
  47. }
  48.  
  49. PUBLIC POLLS::POLLS()
  50.     : CONFIG_OBJS (f_poll)
  51. {
  52. }
  53.  
  54. PUBLIC POLL *POLLS::getitem(int no)
  55. {
  56.     return (POLL*)ARRAY::getitem(no);
  57. }
  58.  
  59. /*
  60.     Locate one machine Permission spec
  61. */
  62. PUBLIC POLL *POLLS::getitem(const char *system)
  63. {
  64.     int n = getnb();
  65.     POLL *ret = NULL;
  66.     for (int i=0; i<n; i++){
  67.         POLL* p = getitem(i);
  68.         if (p->system.cmp(system)==0){
  69.             ret = p;
  70.             break;
  71.         }
  72.     }
  73.     return ret;
  74. }
  75.  
  76. PROTECTED CONFIG_OBJ *POLLS::newobj (
  77.     const char *buf,    // Buffer to parse from the Permissions file
  78.     const SSTRING &_comments,    // Comments preceding the definition
  79.     char *err)            // Will contain error message or '\0'
  80. {
  81.     return new POLL (buf,_comments,err);
  82. }
  83.  
  84.  
  85.  
  86.